// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.

#ifndef CEF_TESTS_CEFCLIENT_RENDERER_AUDIO_CAPTURE_H_
#define CEF_TESTS_CEFCLIENT_RENDERER_AUDIO_CAPTURE_H_
#pragma once

#include "include/cef_base.h"
#include "tests/shared/renderer/client_app_renderer.h"

namespace client {
namespace renderer {

#define audiobufferlen 1024
#define pointcount  128
#define MaxHeight  200
#define  cap_interval 500

	class ClientDownloadImageCallback;

	class AudioCaptureTask : public CefTask {
	public:
		AudioCaptureTask(CefRefPtr<CefV8Value>, CefRefPtr<CefV8Context>);

		void Execute() override;

		void AudioCaptureProc();
		void UpdateLabels();
		static bool isactive_;

	private:
		CefRefPtr<CefBrowser>  browser_;
		float  audio_fft_[audiobufferlen];
		float audio_sumfft_[pointcount];
		int  audio_iit_[pointcount];
		static bool has_init_;
		CefRefPtr<CefV8Context>  js_auct_context_;
		CefRefPtr<CefV8Value>  js_auct_callback_;


		//base::WeakPtr<MultiQueryManager> weak_ptr_;
		//const bool notify_all_;

		IMPLEMENT_REFCOUNTING(AudioCaptureTask);
	};

}  // namespace renderer
}  // namespace client

#endif  // CEF_TESTS_CEFCLIENT_RENDERER_CLIENT_RENDERER_H_
